/* Copyright [2023] <gyl> */
#include "sql/stmt/use_stmt.h"

#include "storage/db/db.h"
#include "storage/default/default_handler.h"

RC UseStmt::create(const UseSqlNode &use, Stmt *&stmt) {
  DefaultHandler &handler = DefaultHandler::get_default();
  if (handler.find_db(use.database.c_str()) == nullptr) {
    return RC::SCHEMA_DB_NOT_EXIST;
  }
  stmt = new UseStmt(use.database);
  return RC::SUCCESS;
}
